/* style.css - 终极修复版 v2 */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: rgba(255, 255, 255, 0.05);
    --accent: #ff6b6b;
    --accent-secondary: #4ecdc4;
    --accent-tertiary: #ffe66d;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    --shadow-colored: 0 25px 50px -12px rgba(255, 107, 107, 0.3);
    --gradient-main: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 50%, #ffe66d 100%);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    --blur: blur(20px);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border: rgba(0, 0, 0, 0.1);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    --shadow-colored: 0 25px 50px -12px rgba(255, 107, 107, 0.2);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.6) 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: all 0.3s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-main);
    opacity: 0.03;
    z-index: -2;
    animation: gradientShift 10s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { transform: translateX(0) translateY(0) scale(1); }
    33% { transform: translateX(-20px) translateY(20px) scale(1.05); }
    66% { transform: translateX(20px) translateY(-20px) scale(0.95); }
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
    50% { transform: translateY(-20px) rotate(180deg); opacity: 0.8; }
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    transition: all 0.3s ease;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.preload-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    margin-right: 15px;
    transition: all 0.3s ease;
}

.preload-indicator i {
    font-size: 16px;
    color: var(--accent);
}

.theme-toggle-btn {
    width: 50px;
    height: 26px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle-btn::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--gradient-main);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .theme-toggle-btn::after {
    transform: translateX(24px);
}

.container {
    padding: 120px 40px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.hero-section {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    line-height: 1.1;
    letter-spacing: -2px;
    animation: slideInUp 1s ease-out;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 400;
    animation: slideInUp 1s ease-out 0.2s both;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 40px;
    align-items: start;
}

.image-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: 30px;
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.image-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gradient-main);
    opacity: 0.6;
}

.image-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-colored);
}

.image-container {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    background: var(--bg-secondary);
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-container:hover {
    transform: scale(1.02);
}

#randomImage {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 24px;
    transition: all 0.5s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.image-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 5;
}

#imageContainer:hover .image-overlay {
    opacity: 1;
}

.overlay-btn {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: var(--blur);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.overlay-btn:hover {
    background: var(--accent);
    transform: scale(1.1);
}

.controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.btn {
    background: var(--gradient-main);
    color: white;
    border: none;
    padding: 18px 28px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(255, 107, 107, 0.4);
}

.btn:active {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.btn:disabled::before {
    content: none; 
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.btn-secondary.small {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    backdrop-filter: var(--blur);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.sidebar-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-colored);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-title i {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 20px 16px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    background: var(--bg-card);
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.content-list {
    max-height: 200px;
    overflow-y: auto;
}

.content-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.12s ease;
}

.content-item:hover {
    background: var(--bg-card);
}

.content-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.content-info {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.remove-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.remove-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.quality-selector {
    display: flex;
    gap: 8px;
}

.quality-btn {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
}

.quality-btn.active,
.quality-btn:hover {
    background: var(--gradient-main);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

.quality-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-secondary);
    color: var(--text-muted);
    transform: none;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 18px;
    color: var(--text-secondary);
    animation: loadingPulse 2s infinite;
    z-index: 2;
    display: none;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

.error-msg {
    display: none;
    margin-top: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.fullscreen-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.95);
    backdrop-filter: var(--blur);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.18s ease-out;
}

.fullscreen-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-sizing: border-box;
    overflow: auto;
}

.fullscreen-image {
    max-width: calc(100% - 80px);
    max-height: calc(100% - 80px);
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    user-select: none;
    -webkit-user-drag: none;
}

.fullscreen-close {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 2100;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.fullscreen-close:hover {
    background: var(--accent);
    transform: scale(1.03);
}

.share-panel {
    position: fixed;
    bottom: -300px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 480px;
    background: var(--gradient-card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1500;
}

.share-panel.active {
    bottom: 0;
}

.share-title {
    text-align: center;
    margin-bottom: 24px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.share-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.share-btn {
    padding: 20px 16px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.share-btn i {
    font-size: 24px;
}

.share-btn.weibo { background: linear-gradient(135deg, #ff6b6b, #ee5a52); }
.share-btn.weixin { background: linear-gradient(135deg, #4ecdc4, #44b3ab); }
.share-btn.qq { background: linear-gradient(135deg, #3498db, #2980b9); }
.share-btn.link { background: linear-gradient(135deg, #9b59b6, #8e44ad); }

.share-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.cancel-btn {
    width: 100%;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.cancel-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.notification {
    position: fixed;
    top: 100px;
    right: 40px;
    background: var(--gradient-card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    z-index: 1000;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    pointer-events: none;
}

.notification.show {
    transform: translateX(0);
}

.notification .notification-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    margin-left: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.management-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.management-options .btn-secondary.small {
    width: auto;
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .sidebar {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
        display: grid;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 20px;
    }
    .nav-actions {
        gap: 10px;
    }
    .preload-indicator {
        margin-right: 5px;
        padding: 6px 10px;
        font-size: 12px;
    }
    .preload-indicator i {
        font-size: 14px;
    }
    .container {
        padding: 100px 20px 20px;
    }
    .sidebar {
        grid-template-columns: 1fr;
        display: flex;
    }
    .controls {
        grid-template-columns: 1fr;
    }
    .notification {
        top: 20px;
        right: 20px;
        left: 20px;
        max-width: unset;
        transform: translateX(calc(100% + 40px));
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
    }
    .image-card {
        padding: 20px;
    }
    .sidebar-card {
        padding: 16px;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-main);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
